package ae.pcfc.cldos.online.common.facade.provider;

import java.util.ArrayList;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import ae.pcfc.cldos.online.common.facade.BaseFacade;
import ae.pcfc.cldos.online.common.facade.CityFacade;
import ae.pcfc.cldos.online.common.tscdb.domain.TTscCity;
import ae.pcfc.cldos.online.common.tscdb.domain.manager.TTscCityDOM;
import ae.pcfc.cldos.online.common.vo.selectors.CityVO;

/**
 * City facade impl
 * 
 * @author arosa
 *
 */
public class CityFacadeImpl extends BaseFacade implements CityFacade {

	private TTscCityDOM tTscCityDOM;

	public void settTscCityDOM(TTscCityDOM tTscCityDOM) {
		this.tTscCityDOM = tTscCityDOM;
	}
	
	
	@Transactional
	public List<CityVO> getCitiesListByCountryCode(String countryCode){
		List<TTscCity> citiesEntitiesList = tTscCityDOM.getCitiesListByCountryCode(countryCode);
		List<CityVO> result = new ArrayList<CityVO>(25);
		for(TTscCity city : citiesEntitiesList){
			CityVO cityVO = new CityVO();
			getMapper().map(city, cityVO);
			result.add(cityVO);
		}
		return result;
	}
	
	
}
